﻿function Request(strName) {
    var strHref = window.document.location.href;
    var intPos = strHref.indexOf("?");
    var strRight = strHref.substr(intPos + 1);

    var arrTmp = strRight.split("&");
    for (var i = 0; i < arrTmp.length; i++) {
        var arrTemp = arrTmp[i].split("=");

        if (arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];
    }
    return "";
}



//////////////////////////////////   解析时间方法 ///////////////////////////////////
function dateTimeFormat(value) {
    var temp = value.replace(/\/Date\((\d+)\)\//gi, "new Date($1)");
    eval('var myDate = ' + temp);
    return myDate;
}
function formatDateTime(value) {
    if (value == undefined || value == '') {
        return '';
    }

    var myDate = dateTimeFormat(value);
    var temp = "";
    if (myDate instanceof Date) {
        var y = myDate.getFullYear();
        var m = myDate.getMonth() + 1;
        var d = myDate.getDate();

        if (m * 1 < 10) {
            m = "0" + m;
        }
        if (d * 1 < 10) {
            d = "0" + d;
        }
        temp = "" + y + "-" + m + "-" + d + "";
    } else {
        temp = "";
    }
    return temp;
}

//////性别
function getSex(value) {
    if (!value) {
        return "未知";
    } else if (value.length == 15) {
        return parseInt(value.substr(13, 1), 10) % 2 ? "男" : "女";
    } else if (value.length == 18) {
        return parseInt(value.substr(16, 1), 10) % 2 ? "1" : "0";
    } else {
        return "未知";
    }
}